package com.sl.mes.app.service;

import java.util.List;

import com.sl.mes.db.vo.MesRegion;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.sl.mes.db.service.MesRegionService;

@Component
public class GetRegionService {

	@Autowired
	private MesRegionService regionService;

	private static List<MesRegion> MesRegions;

	protected List<MesRegion> getMesRegions() {
		if (MesRegions == null) {
			createRegion();
		}
		return MesRegions;
	}

	private synchronized void createRegion() {
		if (MesRegions == null) {
			MesRegions = regionService.getAll();
		}
	}
}
